<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Agent extends Model
{
	const LOCK_STATE_AGENT = 1;//代理商	
	const LOCK_STATE_DIRECT = 2;//直营
	const LOCK_STATE_ORDINARY = 3;//普通

	const LOCK_STATE_AGENT_STRING = '代理商';//代理商
	const LOCK_STATE_DIRECT_STRING = '直营';//直营
	const LOCK_STATE_ORDINARY_STRING = '普通';//普通
	
	
    protected $table = 'at_enterprise_info';
    protected $primaryKey = 'id';
    
    protected $fillable = [
        'id', 'company_name','address','company_type','create_by','company_state','del_flag',
    	'create_date','update_date','province','city','area','join_date','ratio','balance','bank_account','bank_name'	       	
    ];
    
    
    public function linkman()
    {
    	return $this->hasOne(LinkMan::class,'id');//,'at_enterprise_info_id');
    }
    
    public function sysuser(){
    	return $this->hasOne(SysUser::class,'id');
    }
    
    public static function getAgentStateDisplayMap()
    {
    	return [
    			self::LOCK_STATE_AGENT => self::LOCK_STATE_AGENT_STRING,
    			self::LOCK_STATE_DIRECT => self::LOCK_STATE_DIRECT_STRING,
    			self::LOCK_STATE_ORDINARY => self::LOCK_STATE_ORDINARY_STRING,
    	];
    }
    
}
